<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<link rel="stylesheet" type="text/css" href="css/manager.css">

  </head>
  
  <body>
  	<h1 style="margin-bottom:0px;">公司维护列表</h1>
  	<hr style="border:1px dashed #AAA;"/>
  	<input type="button" value="返 回" onclick="history.back();">
  	<input type="button" value="前 进" onclick="history.forward();">
  	<input type="button" value="刷 新" onclick="refresh();">
  	<div style="height:10px;"></div>
    <table border="1" cellpadding="5" cellspacing="0">
    	<tr bgcolor="#EEEEEE"><td>ID</td><td>公司名</td><td>公司规模</td><td>公司业务</td><td>公司地址</td><td>简介</td><td>评分</td><td>操作</td></tr>
    	<c:forEach items="${companys}" var="company">
    	<tr>
    		<td width="30">${company.id}</td>
    		<td width="160">${company.cname}</td>
    		<td width="90">${cscale[company.cscale]}</td>
    		<td width="120">${cbusiness[company.cbusiness]}</td>
    		<td width="130">${company.caddress}</td>
    		<td width="260">${fn:substring(company.cdesc,0,18)}${fn:length(company.cdesc) > 18?'...':''}</td>
    		<td width="40">${company.cscore}</td>
    		<td width="190">
    			<a href="comment.do?method=getCommentByTid&tid=${company.id}&ctype=0" title="共有${company.commentCount}条评论">评论(${company.commentCount})</a>|
    			<a href="company.do?method=updateUI&id=${company.id}&detail=1">详细</a>|
    			<a href="company.do?method=updateUI&id=${company.id}">修改</a>|
    			<a href="javascript:del(${company.id});">删除</a>
    		</td>
    	</tr>
    	</c:forEach>
    	<c:if test="${fn:length(companys)==0}">
    		<tr>
    			<td colspan="8" width="900px">未找到相关记录！</td>
    		</tr>
    	</c:if>
    	
    </table>
    <c:if test="${pv != null}">
    	<%@ include file="../../pages/share/pager.jsp" %>
    </c:if>
    <form action="company.do" method="post" style="display:none;">
    	<input type="hidden" name="method" value="${param.method}">
    	<input type="hidden" name="name" value="${param.name}">
    	<input type="hidden" id="pageNo" name="pageNo" value="">
    </form>
  </body>
  <script type="text/javascript" src="js/javer.js"></script>
  <script type="text/javascript">
  	function del(id) {
  		if (confirm("你确定要删除这条记录？")) {
  			$.get("company.do?method=deleteCompany&id=" + id, function() {
  				alert("删除记录成功，系统将自动刷新！");
  				refresh();
  			});
  		}
  	}
  	function refresh() {
  		document.forms[0].submit();;
  	}
  	function topage(pageNo) {
  		$("pageNo").value(pageNo);
  		document.forms[0].submit();;
  	}
  </script>
</html>
